package com.remoter.basic.bean.support;

import com.remoter.basic.bean.AbstractMessage;
import com.remoter.basic.util.StringUtil;

/**
 * @author			koko
 * @date 			2017-08-09 09:14:22
 * @description 	类功能说明
 */
public class RemoterResponse extends AbstractMessage{

	private static final long serialVersionUID = -3419467564598924617L;
	
	private long token;//响应令牌.必须和请求令牌一致
	private Object data;//返回的具体数据
	private String exception;//返回的异常信息,如果exception 不为null,则认为存在异常
	
	public RemoterResponse(){}
	public RemoterResponse(long token){
		this.token = token;
	}
	public long getToken() {
		return token;
	}
	public void setToken(long token) {
		this.token = token;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public String getException() {
		return exception;
	}
	public void setException(String exception) {
		this.exception = exception;
	}
	
	public boolean hasException(){
		return StringUtil.isBlank(this.exception) ? false : true;
	}
	
	@Override
	public String toString(){
		StringBuilder sb = new StringBuilder(super.toString());
		sb.append("{");
		sb.append("token:").append(this.token).append(",");
		sb.append("data:").append(this.data).append(",");
		sb.append("exception:").append(this.exception).append("}");
		return sb.toString();
	}
	
	
}